#ifndef FPSMONITORINGCOMPONENT_H_
#define FPSMONITORINGCOMPONENT_H_

#include "LibraryFrameworkExport.h"
#include "Game/GameTime.h"
#include "Entities/Component.h"
#include "Sprite/SpriteRenderer.h"
#include "Graphics/Color.h"
#include "Sprite/SpriteTypes.h"
#include "Graphics/Model/Model.h"
#include "Game/Line2DRendererComponent.h"
#include "Entities/Components/TransformComponent.h"
#include "Entities/Events/DebugToolEvents.h"
#include "Tools/DebugSystem.h"

#include <iosfwd>
#include <string>
#include <vector>

namespace CasaEngine
{
	/*
	 *	
	 */
	class LIBRARY_FRAMEWORK_EXPORT FPSMonitoringComponent :
		public Component
	{
	private:
		TransformComponent* m_pTransform;
		Line2DRendererComponent *m_pLineRenderer;
		DebugSystem *pDebugSystem;
		
		std::vector<int> m_FPSData;
		int m_iFPSMin, m_iFPSMax;
		//change to indicator : std::map<int, CColor>
		int m_iThresholdMin, m_iThresholdMax;
		unsigned int m_uiMaxNbData;
		
	public:
		FPSMonitoringComponent(BaseEntity* pEntity_);
		virtual ~FPSMonitoringComponent();

		//all entities must implement an Initialize function
		void Initialize();

		//all entities must implement an update function
		void  Update(const GameTime& gameTime_);

		//all entities can communicate using messages. They are sent
		//using the MessageDispatcher singleton class
		void OnFPSChange(const FPSChangeEvent* pEvent_);

		//entities should be able to read/write their data to a stream
		void Write(std::ostream&  os)const;
		void Read (std::ifstream& is);
	};

}

#endif // FPSMONITORINGCOMPONENT_H_
